package com.example.demo;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/request")
public class article {
    //获取URL中的PathVariable参数
    @RequestMapping ("/articleid/{id}/{name}")
    //在第一个PathVariable添加("id")是错误写法
    public String testarticle(@PathVariable("id") String id,@PathVariable("name") String name){
        return "地址:"+id+"名称:"+name;
    }
}
